home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3s / fwscanf.z / fwscanf
Encoding:
Text File  |  2002-10-03  |  23.2 KB  |  395 lines

  1.  
  2.  
  3.  
  4. ffffwwwwssssccccaaaannnnffff((((3333SSSS))))                                                        ffffwwwwssssccccaaaannnnffff((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ffff_wwww_ssss_cccc_aaaa_nnnn_ffff_:::: _ffff_wwww_ssss_cccc_aaaa_nnnn_ffff_,,,, _wwww_ssss_cccc_aaaa_nnnn_ffff_,,,, _ssss_wwww_ssss_cccc_aaaa_nnnn_ffff - convert formatted wide-character
  10.      input
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_ssss_tttt_dddd_iiii_oooo_...._hhhh_>>>>
  14.      _####_iiii_nnnn_cccc_llll_uuuu_dddd_eeee _<<<<_wwww_cccc_hhhh_aaaa_rrrr_...._hhhh_>>>>
  15.      _iiii_nnnn_tttt _ffff_wwww_ssss_cccc_aaaa_nnnn_ffff_((((_FFFF_IIII_LLLL_EEEE _****_ssss_tttt_rrrr_eeee_aaaa_mmmm_,,,, _cccc_oooo_nnnn_ssss_tttt _wwww_cccc_hhhh_aaaa_rrrr______tttt _****_ffff_oooo_rrrr_mmmm_aaaa_tttt_,,,, _...._...._...._))))_;;;;
  16.      _iiii_nnnn_tttt _wwww_ssss_cccc_aaaa_nnnn_ffff_((((_cccc_oooo_nnnn_ssss_tttt _wwww_cccc_hhhh_aaaa_rrrr______tttt _****_ffff_oooo_rrrr_mmmm_aaaa_tttt_,,,, _...._...._...._))))_;;;;
  17.      _iiii_nnnn_tttt _ssss_wwww_ssss_cccc_aaaa_nnnn_ffff_((((_cccc_oooo_nnnn_ssss_tttt _cccc_hhhh_aaaa_rrrr _****_ssss_,,,, _cccc_oooo_nnnn_ssss_tttt _wwww_cccc_hhhh_aaaa_rrrr______tttt _****_ffff_oooo_rrrr_mmmm_aaaa_tttt_,,,, _...._...._...._))))_;;;;
  18.  
  19. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  20.      _ffff_wwww_ssss_cccc_aaaa_nnnn_ffff reads from the stream _s_t_r_e_a_m.
  21.  
  22.      _wwww_ssss_cccc_aaaa_nnnn_ffff reads from the standard input stream _s_t_d_i_n.
  23.  
  24.      _ssss_wwww_ssss_cccc_aaaa_nnnn_ffff reads from the wide-character string *_s.
  25.  
  26.      Each function reads wide-characters, interprets them according to a
  27.      format, and stores the results in its arguments.  Each expects, as
  28.      arguments, a control wide-character string _f_o_r_m_a_t described below, and a
  29.      set of pointer arguments indicating where the converted input should be
  30.      stored.  If there are insufficient arguments for the format, the behavior
  31.      is undefined.  If the format is exhausted while arguments remain, the
  32.      excess arguments are simply ignored.
  33.  
  34.      The control string usually contains conversion specifications, which are
  35.      used to direct interpretation of input sequences.  The control string may
  36.      contain:
  37.  
  38.           1.  White-space wide-characters (blanks, tabs, newlines, or form-
  39.               feeds) that, except in two cases described below, cause input to
  40.               be read up to the next non-white-space character.
  41.  
  42.           2.  An ordinary wide-character (not _%%%%) that must match the next
  43.               character of the input stream.
  44.  
  45.           3.  Conversion specifications consisting of the character _%%%% or the
  46.               character sequence _%%%%_d_i_g_i_t_s_$$$$, an optional assignment suppression
  47.               character _****, a decimal digit string that specifies an optional
  48.               numerical maximum field width, an optional letter _llll (ell), _LLLL, or
  49.               _hhhh indicating the size of the receiving object, and a conversion
  50.               code.  The conversion wide-characters _cccc, _ssss and _[[[[ must be
  51.               preceded by _llll _((((_eeee_llll_llll_)))) if the corresponding argument is a pointer
  52.               to wchar_t rather than a pointer to a character type. The
  53.               conversion wide-characters _dddd, _iiii and _nnnn must be preceded by _hhhh if
  54.               the corresponding argument is a pointer to short int rather than
  55.               a pointer to int, or by _llll _((((_eeee_llll_llll_)))) if it is a pointer to long int.
  56.               Similarly, the conversion wide-characters _oooo, _uuuu and _xxxx must be
  57.               preceded by _hhhh if the corresponding argument is a pointer to
  58.               unsigned short int rather than a pointer to unsigned int or by _llll
  59.  
  60.  
  61.                                                                         PPPPaaaaggggeeee 1111
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. ffffwwwwssssccccaaaannnnffff((((3333SSSS))))                                                        ffffwwwwssssccccaaaannnnffff((((3333SSSS))))
  69.  
  70.  
  71.  
  72.               _((((_eeee_llll_llll_)))) if it is a pointer to unsigned long int. The conversion
  73.               wide-characters _eeee, _ffff and _gggg must be preceded by _llll _((((_eeee_llll_llll_)))) if the
  74.               corresponding argument is a pointer to double rather than a
  75.               pointer to float, or by _LLLL if it is a pointer to long double. If
  76.               an _hhhh, _llll _((((_eeee_llll_llll_)))) or _LLLL appears with any other conversion wide-
  77.               character, the behaviour is undefined.
  78.  
  79.      A conversion wide-character specification directs the conversion of the
  80.      next input field; the result is placed in the variable pointed to by the
  81.      corresponding argument unless assignment suppression was indicated by the
  82.      character _****.  The suppression of assignment provides a way of describing
  83.      an input field that is to be skipped.  An input field is defined as a
  84.      string of non-space wide-characters; it extends to the next inappropriate
  85.      wide-character or until the maximum  field width, if one is specified, is
  86.      exhausted.  For all descriptors except the character _[[[[ and the character
  87.      _cccc, white space leading an input field is ignored.
  88.  
  89.      Conversions can be applied to the _n_t_h argument in the argument list,
  90.      rather than to the next unused argument.  In this case, the conversion
  91.      character _%%%% (see above) is replaced by the sequence _%%%%_d_i_g_i_t_s_$$$$ where _d_i_g_i_t_s
  92.      is a decimal integer _n, giving the position of the argument in the
  93.      argument list.  The first such argument, _%%%%_1111_$$$$, immediately follows _f_o_r_m_a_t.
  94.      The control string can contain either form of a conversion specification,
  95.      i.e., _%%%% or _%%%%_d_i_g_i_t_s_$$$$, although the two forms cannot be mixed within a
  96.      single control string.
  97.  
  98.      The conversion code indicates the interpretation of the input field; the
  99.      corresponding pointer argument must usually be of a restricted type.  For
  100.      a suppressed field, no pointer argument is given.  The following
  101.      conversion codes are valid:
  102.  
  103.      _%%%%    A single _%%%% is expected in the input at this point; no assignment is
  104.           done.
  105.  
  106.      _dddd    Matches an optionally signed decimal integer, whose format is the
  107.           same as expected for the subject sequence of the _wwww_cccc_ssss_tttt_oooo_llll function
  108.           with the value 10 for the _b_a_s_e argument.  The corresponding argument
  109.           should be a pointer to integer.
  110.  
  111.      _uuuu    Matches an optionally signed decimal integer, whose format is the
  112.           same as expected for the subject sequence of the _wwww_cccc_ssss_tttt_oooo_uuuu_llll function
  113.           with the value 10 for the _b_a_s_e argument.  The corresponding argument
  114.           should be a pointer to unsigned integer.
  115.  
  116.      _oooo    Matches an optionally signed octal integer, whose format is the same
  117.           as expected for the subject sequence of the _wwww_cccc_ssss_tttt_oooo_uuuu_llll function with
  118.           the value 8 for the _b_a_s_e argument.  The corresponding argument
  119.           should be a pointer to unsigned integer.
  120.  
  121.      _xxxx    Matches an optionally signed hexadecimal integer, whose format is
  122.           the same as expected for the subject sequence of the _wwww_cccc_ssss_tttt_oooo_uuuu_llll
  123.           function with the value 16 for the _b_a_s_e argument.  The corresponding
  124.  
  125.  
  126.  
  127.                                                                         PPPPaaaaggggeeee 2222
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134. ffffwwwwssssccccaaaannnnffff((((3333SSSS))))                                                        ffffwwwwssssccccaaaannnnffff((((3333SSSS))))
  135.  
  136.  
  137.  
  138.           argument should be a pointer to unsigned integer.
  139.  
  140.      _iiii    Matches an optionally signed integer, whose format is the same as
  141.           expected for the subject sequence of the _wwww_cccc_ssss_tttt_oooo_llll function with the
  142.           value 0 for the _b_a_s_e argument.  The corresponding argument should be
  143.           a pointer to integer.
  144.  
  145.      _nnnn    No input is consumed.  The corresponding argument should be a
  146.           pointer to integer into which is to be written the number of
  147.           characters read from the input stream so far by the call to the
  148.           function.  Execution of a _%%%%_nnnn directive does not increment the
  149.           assignment count returned at the completion of execution of the
  150.           function.
  151.  
  152.      _eeee,_ffff,_gggg
  153.           Matches an optionally signed floating point number, whose format is
  154.           the same as expected for the subject string of the _wwww_cccc_ssss_tttt_oooo_dddd function.
  155.           In the absence of a size modifier, the corresponding argument must
  156.           be a pointer to float. If the fwprintf() family of functions
  157.           generates character string representations for infinity and NaN (a
  158.           7858 symbolic entity encoded in floating-point format) to support
  159.           the ANSI/IEEE Std 754:1985 standard, the fwscanf() family of
  160.           functions will recognise them as input.
  161.  
  162.      _ssss    Matches a sequence of non white-space wide-characters. If no _llll _((((_eeee_llll_llll_))))
  163.           qualifier is present, characters from the input field are converted
  164.           as if by repeated calls to the wcrtomb() function, with the
  165.           conversion state described by an mbstate_t object initialised to
  166.           zero before the first wide-character is converted. The corresponding
  167.           argument must be a pointer to a character array large enough to
  168.           accept the sequence and the terminating null character, which will
  169.           be added automatically. Otherwise, the corresponding argument must
  170.           be a pointer to an array of wchar_t large enough to accept the
  171.           sequence and the terminating null wide-character, which will be
  172.           added automatically.
  173.  
  174.      _SSSS    Same as _llll_ssss
  175.  
  176.      _cccc    Matches a sequence of wide-characters of the number specified by the
  177.           field width (1 if no field width is present in the conversion
  178.           specification). If no _llll _((((_eeee_llll_llll_)))) qualifier is present, wide-characters
  179.           from the input field are converted as if by repeated calls to the
  180.           wcrtomb() function, with the conversion state described by an
  181.           mbstate_t object initialised to zero before the first wide-character
  182.           is converted. The corresponding argument must be a pointer to a
  183.           character array large enough to accept the sequence. No null
  184.           character is added. Otherwise, the corresponding argument must be a
  185.           pointer to an array of wchar_t large enough to accept the sequence.
  186.           No null wide-character is added.  The normal skip over white space
  187.           is suppressed.
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                                                         PPPPaaaaggggeeee 3333
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200. ffffwwwwssssccccaaaannnnffff((((3333SSSS))))                                                        ffffwwwwssssccccaaaannnnffff((((3333SSSS))))
  201.  
  202.  
  203.  
  204.      _CCCC    Same as _llll_cccc
  205.  
  206.      _[[[[    Matches a nonempty sequence of characters from a set of expected
  207.           characters (the _s_c_a_n_s_e_t).  The corresponding argument should be a
  208.           pointer to the initial character of an array large enough to accept
  209.           the sequence and a terminating null character, which will be added
  210.           automatically.  The conversion specifier includes all subsequent
  211.           characters in the _f_o_r_m_a_t string, up to and including the matching
  212.           right bracket (_]]]]).  The characters between the brackets (the
  213.           _s_c_a_n_l_i_s_t) comprise the scanset, unless the character after the left
  214.           bracket is a circumflex (_^^^^), in which case the scanset contains all
  215.           characters that do not appear in the scanlist between the circumflex
  216.           and the right bracket.  If the conversion specifier begins with _[[[[_]]]]
  217.           or _[[[[_^^^^_]]]], the right bracket character is in the scanlist and the next
  218.           right bracket character is the matching right bracket that ends the
  219.           specification; otherwise the first right bracket character is the
  220.           one that ends the specification.
  221.  
  222.           A range of characters in the scanset may be represented by the
  223.           construct _f_i_r_s_t _---- _l_a_s_t; thus _[[[[_0000_1111_2222_3333_4444_5555_6666_7777_8888_9999_]]]] may be expressed _[[[[_0000_----_9999_]]]].
  224.           Using this convention, _f_i_r_s_t must be lexically less than or equal to
  225.           _l_a_s_t, or else the dash will stand for itself. The character _---- will
  226.           also stand for itself whenever it is the first or the last character
  227.           in the scanlist.  To include the right bracket as an element of the
  228.           scanset, it must appear as the first character (possibly preceded by
  229.           a circumflex) of the scanlist and in this case it will not be
  230.           syntactically interpreted as the closing bracket.  At least one
  231.           character must match for this conversion to be considered
  232.           successful.
  233.  
  234.      _pppp    Matches an implementation-defined set of sequences, which should be
  235.           the same as the set of sequences that may be produced by the _%%%%_pppp
  236.           conversion of the _ffff_wwww_pppp_rrrr_iiii_nnnn_tttt_ffff function. The corresponding argument
  237.           should be a pointer to _vvvv_oooo_iiii_dddd. The interpretation of the input item is
  238.           implementation-defined. If the input item is a value converted
  239.           earlier during the same program execution, the pointer that results
  240.           shall compare equal to that value; otherwise, the behavior of the _%%%%_pppp
  241.           conversion is undefined.
  242.  
  243.      If an invalid conversion character follows the _%%%%, the results of the
  244.      operation may not be predictable.
  245.  
  246.      The conversion specifiers _EEEE, _GGGG, and _XXXX are also valid and behave the same
  247.      as _eeee, _gggg, and _xxxx, respectively.
  248.  
  249.      Each function allows for detection of a language-dependent decimal-point
  250.      character in the input string.  The decimal-point character is defined by
  251.      the program's locale (category _LLLL_CCCC______NNNN_UUUU_MMMM_EEEE_RRRR_IIII_CCCC).  In the _""""_CCCC_"""" locale, or in a
  252.      locale where the decimal-point character is not defined, the decimal-
  253.      point character defaults to a period (_....).
  254.  
  255.  
  256.  
  257.  
  258.  
  259.                                                                         PPPPaaaaggggeeee 4444
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266. ffffwwwwssssccccaaaannnnffff((((3333SSSS))))                                                        ffffwwwwssssccccaaaannnnffff((((3333SSSS))))
  267.  
  268.  
  269.  
  270.      If end-of-file is encountered during input, conversion is terminated. If
  271.      end-of-file occurs before any wide-characters matching the current
  272.      conversion specification (except for %n) have been read (other than
  273.      leading white-space, where permitted), execution of the current
  274.      conversion specification terminates with an input failure.  Otherwise,
  275.      unless execution of the current conversion specification is terminated
  276.      with a matching failure, execution of the following conversion
  277.      specification (if any) is terminated with an input failure.
  278.  
  279.      Reaching the end of the string in swscanf() is equivalent to encountering
  280.      end-of-file for fwscanf().
  281.  
  282.      If conversion terminates on a conflicting input character, the offending
  283.      input character is left unread in the input stream.  Trailing white space
  284.      (including newline characters) is left unread unless matched by a
  285.      directive.  The success of literal matches and suppressed assignments is
  286.      not directly determinable other than via the _%%%%_nnnn directive.
  287.  
  288.      The _ffff_wwww_ssss_cccc_aaaa_nnnn_ffff_((((_)))) and _wwww_ssss_cccc_aaaa_nnnn_ffff_((((_)))) functions may mark the st_atime field of the
  289.      file associated with stream for update. The st_atime field will be marked
  290.      for update by the first successful execution of _ffff_gggg_eeee_tttt_cccc_((((_)))), _ffff_gggg_eeee_tttt_wwww_cccc_((((_)))),
  291.      _ffff_gggg_eeee_tttt_ssss_((((_)))), _ffff_gggg_eeee_tttt_wwww_ssss_((((_)))), _ffff_rrrr_eeee_aaaa_dddd_((((_)))), _gggg_eeee_tttt_cccc_((((_)))), _gggg_eeee_tttt_wwww_cccc_((((_)))), _gggg_eeee_tttt_cccc_hhhh_aaaa_rrrr_((((_)))), _gggg_eeee_tttt_wwww_cccc_hhhh_aaaa_rrrr_((((_)))),
  292.      _gggg_eeee_tttt_ssss_((((_)))), _ffff_ssss_cccc_aaaa_nnnn_ffff_((((_)))) or _ffff_wwww_ssss_cccc_aaaa_nnnn_ffff_((((_)))) using stream that returns data not supplied
  293.      by a prior call to _uuuu_nnnn_gggg_eeee_tttt_cccc_((((_)))).
  294.  
  295. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  296.      The call to the function _wwww_ssss_cccc_aaaa_nnnn_ffff:
  297.  
  298.           _iiii_nnnn_tttt _iiii_,,,, _nnnn_;;;; _ffff_llll_oooo_aaaa_tttt _xxxx_;;;; _cccc_hhhh_aaaa_rrrr _nnnn_aaaa_mmmm_eeee_[[[[_5555_0000_]]]]_;;;;
  299.           _nnnn _==== _wwww_ssss_cccc_aaaa_nnnn_ffff _((((_LLLL_""""_%%%%_dddd_%%%%_ffff_%%%%_ssss_""""_,,,, _&&&&_iiii_,,,, _&&&&_xxxx_,,,, _nnnn_aaaa_mmmm_eeee_))))_;;;;
  300.  
  301.      with the input line:
  302.  
  303.           _2222_5555 _5555_4444_...._3333_2222_EEEE_----_1111 _tttt_hhhh_oooo_mmmm_pppp_ssss_oooo_nnnn
  304.  
  305.      will assign to _nnnn the value _3333, to _iiii the value _2222_5555, to _xxxx the value _5555_...._4444_3333_2222,
  306.      and _nnnn_aaaa_mmmm_eeee will contain _tttt_hhhh_oooo_mmmm_pppp_ssss_oooo_nnnn_\\\\_0000.
  307.  
  308.      The call to the function _wwww_ssss_cccc_aaaa_nnnn_ffff:
  309.  
  310.           _iiii_nnnn_tttt _iiii_;;;; _ffff_llll_oooo_aaaa_tttt _xxxx_;;;; _cccc_hhhh_aaaa_rrrr _nnnn_aaaa_mmmm_eeee_[[[[_5555_0000_]]]]_;;;;
  311.           _((((_vvvv_oooo_iiii_dddd_)))) _wwww_ssss_cccc_aaaa_nnnn_ffff _((((_LLLL_""""_%%%%_2222_dddd_%%%%_ffff_%%%%_****_dddd _%%%%_[[[[_0000_----_9999_]]]]_""""_,,,, _&&&&_iiii_,,,, _&&&&_xxxx_,,,, _nnnn_aaaa_mmmm_eeee_))))_;;;;
  312.  
  313.      with the input line:
  314.  
  315.           _5555_6666_7777_8888_9999 _0000_1111_2222_3333 _5555_6666_aaaa_7777_2222
  316.  
  317.      will assign _5555_6666 to _iiii, _7777_8888_9999_...._0000 to _xxxx, skip _0000_1111_2222_3333, and place the characters _5555_6666_\\\\_0000
  318.      in _nnnn_aaaa_mmmm_eeee.  The next character read from _ssss_tttt_dddd_iiii_nnnn will be _aaaa.
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                                                         PPPPaaaaggggeeee 5555
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332. ffffwwwwssssccccaaaannnnffff((((3333SSSS))))                                                        ffffwwwwssssccccaaaannnnffff((((3333SSSS))))
  333.  
  334.  
  335.  
  336. NNNNOOOOTTTTEEEESSSS
  337.      These functions are supported in n32 and 64 bit C Libraries for IRIX
  338.      6.5.17 and later versions.
  339.  
  340. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  341.      _gggg_eeee_tttt_wwww_cccc(3S), _ffff_wwww_pppp_rrrr_iiii_nnnn_tttt_ffff(3S), _ssss_eeee_tttt_llll_oooo_cccc_aaaa_llll_eeee(3C), _wwww_cccc_tttt_oooo_mmmm_bbbb(3C), _wwww_cccc_ssss_tttt_oooo_dddd(3S),
  342.      _wwww_cccc_ssss_tttt_oooo_llll(3S), _wwww_cccc_ssss_tttt_oooo_uuuu_llll(3S), _llll_aaaa_nnnn_gggg_iiii_nnnn_ffff_oooo(5), _ssss_tttt_dddd_iiii_oooo(3S).
  343.  
  344. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  345.      These routines return the number of successfully matched and assigned
  346.      input items; this number can be zero in the event of an early matching
  347.      failure between an input character and the control string.  If the input
  348.      ends before the first matching failure or conversion, _EEEE_OOOO_FFFF is returned.
  349.  
  350.      In addition, all forms of fwscanf() may fail if:
  351.  
  352.      [EILSEQ]
  353.           Input byte sequence does not form a valid character.
  354.      [EINVAL]
  355.           There are insufficient arguments.
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.                                                                         PPPPaaaaggggeeee 6666
  392.  
  393.  
  394.  
  395.